package com.lms.controller;

import com.lms.entity.Rearbaseinfo;
import com.lms.entity.Saveschoolbaseinfo;
import com.lms.service.*;
import com.lms.vo.GreenschoolbaseinfoVo;
import com.lms.vo.TeachEvalBaseInfoVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 * @Description: 系统公共控制器类
 * @author: L-B-S
 * @Date: 2021/3/4 17:39
 * @modified_By:
 * @Version: 0.0$
 */
@Controller
public class SysController {

    @Autowired
    private RearBaseInfoService rearBaseInfoService;
    @Autowired
    private TeachevalbaseinfoService teachevalbaseinfoService;
    @Autowired
    private GreenschoolbaseinfoService greenschoolbaseinfoService;
    @Autowired
    private SaveschoolbaseinfoService saveschoolbaseinfoService;
    @Autowired
    private AdminService adminService;

    @ResponseBody
    @PostMapping(value = "/rbi")
    public List<Rearbaseinfo> rbiList() {
        return rearBaseInfoService.rbiList();
    }

    @ResponseBody
    @PostMapping(value = "/tebi")
    public TeachEvalBaseInfoVo tebiList() {
        return teachevalbaseinfoService.tebiList();
    }

    @ResponseBody
    @PostMapping(value = "/gsbi")
    public GreenschoolbaseinfoVo gsbiList() {
        return greenschoolbaseinfoService.gsbiList();
    }

    @ResponseBody
    @PostMapping(value = "/ssbi")
    public List<Saveschoolbaseinfo> ssbiList() {
        return saveschoolbaseinfoService.ssbiList();
    }

    @ResponseBody
    @PostMapping(value = "/sys/adminAuth")
    public int adminAuth(String secretKey) {
        return adminService.adminAuth(secretKey);
    }

    @GetMapping(value = "/sys/{url}")
    public String redirect(@PathVariable("url") String url) {
        return "sys/" + url;
    }
}
